home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
-
- FnError.cp
-
- ***********************************************************************/
-
- /*
- Provides a very simple error dialog in the center of the screen.
- You have the option of immediately quitting application after user
- clicks OK.
-
- Functions Include:
-
- FnErr_DisplayStrID Display error using string ID
- FnErr_DisplayStr Display error string
- */
-
- /********** Available Error ID's */
- const short kGeneralError = 900;
- const short kBadSystem = 901;
- const short kNoResource = 902;
- const short kAppleEventError = 903;
-
- /********** Constants */
- const short kErrorAlert = 900;
- #define kNilPtr 0L
- #define kNilStr "\p"
- #define kFatalError "\pFatal Error!"
-
- /********** Prototypes */
- void FnErr_DisplayStrID( int stringNum,
- int quitFlag );
- void FnErr_DisplayStr( Str255 s1,
- Str255 s2,
- Str255 s3,
- Str255 s4,
- int quitFlag );
-
- /********** DisplayStrID */
-
- void FnErr_DisplayStrID( int stringNum, int quitFlag )
- {
- StringHandle errorStringH;
-
- if ( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
- ParamText( kFatalError, kNilStr, kNilStr, kNilStr );
- else
- {
- HLock( (Handle)errorStringH );
- ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
- HUnlock( (Handle)errorStringH );
- }
- StopAlert( kErrorAlert, kNilPtr );
- if( quitFlag )
- ExitToShell();
- }
-
- /********** DisplayStr */
-
- void FnErr_DisplayStr( Str255 s1,
- Str255 s2,
- Str255 s3,
- Str255 s4,
- int quitFlag )
- {
- ParamText( s1, s2, s3, s4 );
- StopAlert( kErrorAlert, kNilPtr );
- if( quitFlag )
- ExitToShell();
- }
-
-
- /**********************************************************************
-
- FnError.r
-
- ***********************************************************************/
-
- #include <Types.r>
-
- resource 'DITL' (900, "Error Alert") {
- { /* array DITLarray: 2 elements */
- /* [1] */
- {59, 288, 79, 348},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 75, 54, 343},
- StaticText {
- enabled,
- "^0^1^2^3"
- }
- }
- };
-
- resource 'ALRT' (900, "Error Alert") {
- {94, 80, 183, 438},
- 900,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, sound1,
- /* [2] */
- OK, visible, sound1,
- /* [3] */
- OK, visible, sound1,
- /* [4] */
- OK, visible, sound1,
- },
- };
-
- resource 'STR ' (900, "General Error") {
- "Sorry, but a fatal error just occured!"
- };
-
- resource 'STR ' (901, "System Error") {
- "Sorry, you must have System 7 or later to run this application."
- };
-
- resource 'STR ' (902, "Resource Error") {
- "Error: Resource could not be loaded."
- };
-
- resource 'STR ' (903, "Can't Handle AppleEvent Error") {
- "Error: Could not handle AppleEvent."
- };
-
- // End of File